﻿package net.wangit.user.org;

import java.io.Serializable;
import java.util.Map;

import net.wangit.util.ArrayUtil;


public class Org implements Serializable {

	private static final long serialVersionUID = 1L;
	private String id;
	private String name;
	private String roles[];
	private Map privileges;
	private Map properties;

	protected Org(String id) {
		this.id = id;
	}

	public String get(String name) {
		return (String) properties.get(name);
	}

	public String getId() {
		return id;
	}

	public String getName() {
		return name;
	}

	protected void setName(String name) {
		this.name = name;
	}

	public String[] getRoles() {
		return roles;
	}

	public boolean containsRole(String roleId) {
		return ArrayUtil.find(roles, roleId) >= 0;
	}

	protected void setRoles(String roles[]) {
		this.roles = roles;
	}

	public Map getPrivileges() {
		return privileges;
	}

	protected void setPrivileges(Map privileges) {
		this.privileges = privileges;
	}

	protected void setProperties(Map properties) {
		this.properties = properties;
	}
}
